package com.example.czxyproduct.mapper;

import com.yc.czxy.Mapper.BaseMapper;
import com.yc.czxy.bean.Adva;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AdvaMapper extends BaseMapper {

//    @Select("select * from adva")
//    List<Adva> selectAdva();
//            "<where>" +
//            "   status =1 " +
//            "   <if test=\"title != null\"> and title = #{title}</if>" +
//            "</where>" +
//            "</script>"})
    @Select({"select * from adva where status=1 "})
    List<Adva> selectByObj();

    @Update("update adva set status=2 " +
            " where status=1 and end_time<now() ")
    void ScheduleUpdate();

    @Update("update adva set status=2 where id=#{id}")
    void UpdateById(int id);

    @Select(("select * from adva where id = #{id}"))
    Adva selectById(int id);

    @Update("update adva set click_num=click_num+1 where id = #{id}")
    void updateNum(int id);
}
